<!DOCTYPE html>
 <html>
 <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0'/>
  <title>微信安全支付</title>
 
 
 <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
  <script type="text/javascript">
    //调用微信JS api 支付
    function jsApiCall()
    {
      WeixinJSBridge.invoke(
        'getBrandWCPayRequest',
        <?php echo $jsApiParameters; ?>,
        function(res){
          WeixinJSBridge.log(res.err_msg);
          if(res.err_msg == "get_brand_wcpay_request:ok"){
          alert(res.err_code+res.err_desc+res.err_msg);
            /*这里写如果支付成功的话执行什么操作*/
          }else{
            //返回跳转到订单详情页面
            alert(支付失败);
               
          }
        }
      );
    }
    function callpay()
    {
      if (typeof (WeixinJSBridge) == "undefined"){
        if( document.addEventListener ){
          document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
        }else if (document.attachEvent){
          document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
          document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
        }
      }else{
        jsApiCall();
      }
   
   
    }
 
 
 
  
  </script>
 </head>
 <body>
 <button style="width:210px; height:30px; background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer; color:white; font-size:16px;" type="button" OnClientClick="javascript:callpay();return false;" id="asd" >支付</button>
 
  </div>
 </body>
 </html>
